package com.shms.bean;

/**
 * 文件名：StringArray.java 
 * 编写者：习孟冬
 * 创建时间：2013-1-18 
 * 简要描述： 
 * 不定长String类型动态数组
 */
public class StringArray {
	// 数组长度
	private int theSize = 0;
	// 数组
	private String newString[] = {};

	public StringArray() {
		this.theSize = 0;
	}

	public StringArray(String temp[]) {
		this.newString = temp;
		this.theSize = temp.length;
	}

	/**
	 * 数组增加一个数值
	 * @param temp String 对象
	 */
	public void add(String temp) {
		String oldString[] = this.newString;
		this.newString = new String[this.theSize + 1];
		for (int i = 0; i < oldString.length; i++) {
			this.newString[i] = oldString[i];
		}
		if (this.theSize > 0) {
			this.newString[this.theSize] = temp;
		} else {
			this.newString[0] = temp;
		}
		this.theSize++;
	}

	public int getTheSize() {
		return theSize;
	}

	public void setTheSize(int theSize) {
		this.theSize = theSize;
	}

	public String[] getNewString() {
		return newString;
	}

	public void setNewString(String[] newString) {
		this.newString = newString;
	}
}
